<template>
  <div class="searchUI">
    <i class="iconfont">&#xe617;</i>
    <input
      class="ipt"
      type="text"
      v-on="$listeners"
      @input="input($event.target.value)"
    >
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
import { Prop, Component } from 'vue-property-decorator'
@Component
export default class SearchUI extends Vue {
  timeId: number | undefined
  input (v: string) {
    clearTimeout(this.timeId)
    this.timeId = setTimeout(() => {
      this.$emit('search', v)
    }, 500)
  }
}
</script>

<style scoped>
.searchUI {
  border: 1px solid #ddd;
  position: relative;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
}
.searchUI .iconfont {
  position: absolute;
  top: 0;
  left: 0;
  color: #5f6368;
  padding: 11px;
  /* margin: 3px; */
  font-size: 20px!important;
}
.ipt {
  border: none;
  padding: 11px 0;
  height: 46px;
  outline: none;
  padding: 11px 16px 11px 40px;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
}
</style>
